/*function createMyDiv() {

    var div = document.createElement("div");
	div.id = "wrap";

	// Move the body's children into this wrapper
	while (document.body.firstChild)
	{
		div.appendChild(document.body.firstChild);
	}

	// Append the wrapper to the body
	document.body.appendChild(div);
	document.getElementById("wrap").style.marginTop = "50px";
	
	var wrapdiv = document.createElement("div");
	wrapdiv.id = "body-wrap";

	// Move the body's children into this wrapper
	while (document.body.firstChild)
	{
		wrapdiv.appendChild(document.body.firstChild);
	}

	// Append the wrapper to the body
	document.body.appendChild(wrapdiv);
	
	
	//document.getElementById("wrap").style.position = "absolute";
	//document.getElementById("wrap").style.top = "50px";

	var myDiv = document.createElement('div');
	myDiv.id = 'my_div';

	var btn = document.createElement("BUTTON");        // Create a <button> element
	var t = document.createTextNode("YES");       // Create a text node
	btn.appendChild(t);                                // Append the text to <button>
	btn.class = "my_popup_close btn btn-default";
	btn.id = "my_popup_response_yes";
	myDiv.appendChild(btn);       

	btn = document.createElement("BUTTON");        // Create a <button> element
	t = document.createTextNode("NO");       // Create a text node
	btn.appendChild(t);                                // Append the text to <button>
	btn.class = "my_popup_close btn btn-default";
	btn.id = "my_popup_response_no";
	myDiv.appendChild(btn);       

	//document.getElementsByTagName('body')[0].appendChild(myDiv);
	wrapdiv.insertBefore(myDiv,div);
	
	//div.insertBefore(myDiv,document.body.firstChild);
	
	document.getElementById("my_div").style.position = "fixed";
	document.getElementById("my_div").style.top = "0px";
	document.getElementById("my_div").float = "center";
	
	
}

var timer = setTimeout(createMyDiv,5000);
*/

function createMyDiv() {
var myDiv = document.createElement('div');
	myDiv.id = 'my_div';
	
	var element = document.createElement("b");
	element.innerHTML = "Did you find what you were looking for?  ";
	element.style.color = "white";
	element.style.fontSize = "18px";
    myDiv.appendChild(element);	

	var btn = document.createElement("BUTTON");        // Create a <button> element
	var t = document.createTextNode("YES");       // Create a text node
	btn.appendChild(t);                                // Append the text to <button>
	btn.className = "myButton";
	btn.id = "yes";
	btn.onclick = function () {
	    document.getElementById("my_div").style.visibility = "hidden";
	};
	myDiv.appendChild(btn);       

	btn = document.createElement("BUTTON");        // Create a <button> element
	t = document.createTextNode("NO");       // Create a text node
	btn.appendChild(t);                                // Append the text to <button>
	btn.className = "myButton";
	btn.id = "no";
	btn.onclick = function () {
	    document.getElementById("my_div").style.visibility = "hidden";
	};
	myDiv.appendChild(btn);

	var closeSpan = document.createElement('span');
	closeSpan.id = "closeFloatingDiv";
	closeSpan.innerHTML = "x";
	closeSpan.className = "myButton";
	closeSpan.onclick = function () {
		document.getElementById("my_div").style.visibility = "hidden";
	};
	myDiv.appendChild(closeSpan);

	window.onkeyup = function (event) {
		if (event.keyCode == 27) {
			document.getElementById("my_div").style.visibility = "hidden";
		}
	}
	
	document.getElementsByTagName('body')[0].appendChild(myDiv);
	
	//draggable('my_div');
};

createMyDiv();

var dragObj = null;
function draggable(id)
{
    var obj = document.getElementById(id);
    obj.style.position = "absolute";
    obj.onmousedown = function(){
            dragObj = obj;
    }
}
 
document.onmouseup = function(e){
    dragObj = null;
};

document.onmousemove = function(e){
    var x = e.pageX;
    var y = e.pageY;

    if(dragObj == null)
        return;

    dragObj.style.left = x +"px";
    dragObj.style.top= y +"px";
};